package com.atguigu.gmall.product.mapper;

import com.atguigu.gmall.model.product.BaseAttrInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface BaseAttrInfoMapper extends BaseMapper<BaseAttrInfo> {
    //根据分类查询品台属性及属性值
    List<BaseAttrInfo> attrInfoList(Long category1Id, Long category2Id, Long category3Id);

/*    @Select(
    "<script>select t0.* from base_attr_info t0 " +
    //add here if need left join
    "where 1=1" +
    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
    "<when test='attrName!=null and attrName!=&apos;&apos; '> and t0.attr_name=#{attrName}</when> " +
    "<when test='categoryId!=null and categoryId!=&apos;&apos; '> and t0.category_id=#{categoryId}</when> " +
    "<when test='categoryLevel!=null and categoryLevel!=&apos;&apos; '> and t0.category_level=#{categoryLevel}</when> " +
    //add here if need page limit
    //" limit ${page},${limit} " +
    " </script>")
    List<BaseAttrInfo> pageAll(BaseAttrInfo queryParamDTO, int page, int limit);

    @Select("<script>select count(1) from base_attr_info t0 " +
    //add here if need left join
    "where 1=1" +
    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
    "<when test='attrName!=null and attrName!=&apos;&apos; '> and t0.attr_name=#{attrName}</when> " +
    "<when test='categoryId!=null and categoryId!=&apos;&apos; '> and t0.category_id=#{categoryId}</when> " +
    "<when test='categoryLevel!=null and categoryLevel!=&apos;&apos; '> and t0.category_level=#{categoryLevel}</when> " +
     " </script>")
    int countAll(BaseAttrInfo queryParamDTO);*/

}